This invention relates generally to object-oriented programming and more particularly to a method and system for activation and deactivation of distributed objects in a distributed object system.
Software developers have begun considering the implementation of large distributed object systems. In such systems, distributed objects may be used concurrently by multiple processes. Because these objects are stored in memory, concurrent usage may cause memory management problems. If all distributed objects in a system had to be stored in memory simultaneously, the system would either be very expensive, very slow, or both if the system was a large system. In addition, such a system would waste memory resources because it is unlikely that all objects in the distributed system would be used at the same time.
Accordingly, developers of distributed object systems may find it desirable to load distributed objects into memory when needed for use, but otherwise maintain the object in a database. Unfortunately, existing methods to accomplish the loading of objects into memory when needed often impose significant burdens on the application developer.
The invention comprises a method and system for activation and deactivation of distributed objects. One aspect of the invention is a method for activation and deactivation of distributed objects wherein a first number of a plurality of distributed objects are stored in the memory of a first computer. A request is received to execute a method on a first one of the plurality of distributed objects wherein the first distributed object is to be stored in the memory of the first computer but is not currently stored in the memory. The request comprises the object identity of the first distributed object. One of the first number of distributed objects resident in the memory of the first computer is deactivated in response to the request if a resource limit has been reached. The first distributed object is activated wherein the object-identity of the first distributed object is used to determine the object class and location of the first distributed object. The method is then executed in response to the request.
The invention has several important technical advantages. Because the invention utilizes the object identity to determine the object class and location of a distributed object to be activated, activation can occur automatically using a distributed object system framework. The framework facilitates simplified application development as the application developer does not need to concern himself with details of object activation and deactivation. The invention allows several different methods to be used to determine which object should be activated or deactivated. In addition, an application developer may adjust the resource limit used to determine when the memory of a computer is full based upon the developer""s experience with a particular system. The invention may be used with a persistence service that maintains the state of an object in a database consistently with the state of the object in memory. Thus, deactivation of a distributed object may be accomplished simply and quickly by removing the distributed object from memory.
By activating and deactivating distributed objects as needed, the invention makes efficient use of system resources such as memory. The invention may use protocols similar to cache control protocols to automatically activate and deactivate distributed objects. By using such protocols, the invention may take advantage of the increased probability that an object that has been recently accessed will again be accessed in the near future. By taking advantage of such increased probability, the invention reduces the amount of overhead used for activation and deactivation of distributed objects.